package com.action;

import java.util.ArrayList;
import java.util.List;

import metier.Imetier;
import model.Site;
import model.seo.AnalyseSeo;

import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionSupport;

public class ReferencementAction extends ActionSupport {
	
	@Autowired
	private Imetier metier;
	private Long idSite;
	private Site site;
	List<AnalyseSeo> analyse=new ArrayList<AnalyseSeo>();
	AnalyseSeo ana;
	public Imetier getMetier() {
		return metier;
	}
	public void setMetier(Imetier metier) {
		this.metier = metier;
	}
	public Long getIdSite() {
		return idSite;
	}
	public void setIdSite(Long idSite) {
		this.idSite = idSite;
	}
	public Site getSite() {
		return site;
	}
	public void setSite(Site site) {
		this.site = site;
	}
	public List<AnalyseSeo> getAnalyse() {
		return analyse;
	}
	public void setAnalyse(List<AnalyseSeo> analyse) {
		this.analyse = analyse;
	}
	
	public AnalyseSeo getAna() {
		return ana;
	}
	public void setAna(AnalyseSeo ana) {
		this.ana = ana;
	}
	
	public String Referencement(){
		this.site = this.metier.findSitebyId(this.idSite);
		metier.ajouterReferencement(idSite);
		site=metier.findSitebyId(this.idSite);
		analyse=site.getSeo();
		ana=analyse.get(analyse.size()-1);
	
		return "success";
	}

}
